function getTopTenVideos()
{
  // query to YouTube: the top rated videos
  var script = document.createElement('script');
  script.setAttribute('src', 'http://gdata.youtube.com/feeds/api/standardfeeds/top_favorites?alt=json-in-script&callback=listVideos');
  script.setAttribute('id', 'jsonScript');
  script.setAttribute('type', 'text/javascript');
  document.documentElement.firstChild.appendChild(script);
}

function listVideos(json) 
{
  // add top rated youtube videos
  for (var i = 0; i < json.feed.entry.length; i++) 
  {
    var entry = json.feed.entry[i];
    
    var oChildLink = new BiMenuItem(entry.title.$t);
    oChildLink.vLnkName = entry.title.$t;
    oChildLink.vURL = entry.link[1].href;
		oChildLink.addEventListener("action", function (e) 
		{
			var win = new BiWindow(e.getTarget().vLnkName);
			var tmp = _p.addWindow(win, e.getTarget().vURL);
			tmp.setActive(true);
		});
    oChildLink.setIcon(new BiImage("images/television.png"));    

    oYouTubeMenu.add(oChildLink);
  }
}
